package com.rabbit.videoplayer.tools

import com.rabbit.videoplayer.VideoContextProvider
import com.rabbit.videoplayer.response.PlayerType


class VideoPlayerSPUtil {

    companion object {
        val instance: VideoPlayerSPUtil by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            VideoPlayerSPUtil()
        }
    }

    /** 是否使用硬解解码, 默认硬解 */
    var isEnableHardDecoder: Boolean by PreferenceDelegate(VideoContextProvider.application, "isEnableHardDecoder", true)
    /** 播放器类型，默认tx */
    var playerType: Int by PreferenceDelegate(VideoContextProvider.application, "playerType", PlayerType.ALIYUN)
    /** 是否允许使用Ali播放器，默认true */
    var isAllowUseAliPlayer: Boolean by PreferenceDelegate(VideoContextProvider.application, "isAllowUseAliPlayer", true)
    /** 是否允许使用TX播放器，默认true */
    var isAllowUseTXPlayer: Boolean by PreferenceDelegate(VideoContextProvider.application, "isAllowUseTXPlayer", false)

    fun clear() {
        PreferenceDelegate(VideoContextProvider.application, "VideoSP", 0L).clear()
    }


}

